import cn.itcast.utils.DateUtils;
import org.junit.Test;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class demo {
    //
//    @Test
//    public void test() {
//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
//        Date date = new Date();
//        String format = sdf.format(date);
//        System.out.println(format);
//    }
//
    @Test
    public void test2() throws Exception {
        Date date = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
        String s = "Fri Feb 01 2019 00:00:00 GMT 0800";
        String b= s.substring(0, 24);

        Date date2 = new Date(b);

        System.out.println(date2);
    }

    @Test
    public void test3() throws Exception {
        String s = "Sun Oct 13 20:58:08 CST 2019";
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
        Date date = new Date();
        Date parse = sdf.parse(s);
        System.out.println(parse);

    }
}